﻿<sdk:Page
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
	x:Class="BuildARoute.Views.UserTools" 
	Title="User Tools Page"
	d:DesignWidth="640" d:DesignHeight="480"
	Style="{StaticResource PageStyle}"
	DataContext="{Binding RelativeSource={RelativeSource Self}}">
	
    <sdk:Page.Resources>
        <CollectionViewSource x:Key="tourCollectionViewSource"/>
    </sdk:Page.Resources>

		<Grid x:Name="LayoutRoot" Width="900" Height="700" >
			<StackPanel x:Name="unAuthenticatedContentPanel" Height="184"
                        Style="{StaticResource ContentStackPanelStyle}"
                        Margin="0" Visibility="{Binding UnauthenticatedVisibility}">
				<TextBlock HorizontalAlignment="Stretch" Margin="0"
                           Style="{StaticResource HeaderTextStyle}" Text="NOT LOGGED IN"/>
				<TextBlock HorizontalAlignment="Stretch" Margin="0"
                           Style="{StaticResource ContentTextStyle}" Text="You need to login to make use of the functionality in this page."/>
			</StackPanel>
			<Grid x:Name="AuthenticatedGrid" Height="Auto"
                  Margin="0" Visibility="{Binding ToolsVisibility}" >
				<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
					<TextBlock x:Name="titleMessageTextBlock"
                               Text="{Binding Items.Count, ElementName=tourListBox, StringFormat=You have authored \{0:F0\} routes}"
                               HorizontalAlignment="Stretch" Margin="0"
                               Style="{StaticResource HeaderTextStyle}"  Width="271" Height="30" />
					<Button x:Name="addButton" Width="25" Click="addButton_Click"
                            Content="+" Style="{StaticResource RegisterLoginButtonStyle}"
                            Template="{StaticResource redCircleButtonControlTemplate}"
                            VerticalAlignment="Stretch" HorizontalAlignment="Right"
                            Height="25" Margin="10,0,5,0"
                            ToolTipService.ToolTip="Create a new tour"/>
					<Button x:Name="deleteButton" Content="-" Width="25"
                            Template="{StaticResource redCircleButtonControlTemplate}"
                            Margin="4,0" Height="26" Click="deleteButton_Click"
                            ToolTipService.ToolTip="Delete selected route"/>
					<Button x:Name="editButton" Content="E" Width="26" Height="26"
                            Template="{StaticResource redCircleButtonControlTemplate}"
                            Click="editButton_Click"
                            ToolTipService.ToolTip="Edit selected route" Margin="5,0,0,0"/>
				</StackPanel>
				<Rectangle Height="36" Width="100" Margin="270,30,270,0" VerticalAlignment="Top"/>
				<ListBox Height="605"  x:Name="tourListBox"
						 ItemTemplate="{StaticResource tourDataTemplate}"
						 DataContext="{StaticResource tourCollectionViewSource}"
						 ItemsSource="{Binding}" Width="540" Margin="4,66,0,0" 
						 HorizontalAlignment="Left" VerticalAlignment="Top"/>
		</Grid>	
	</Grid>
</sdk:Page>